home *** CD-ROM | disk | FTP | other *** search
/ Business Shareware / Business Shareware.iso / start / gfxapps / pbmpl91d / pbmplus / man / libpnm.man < prev    next >
Text File  |  1993-01-08  |  6KB  |  215 lines

  1.  
  2.  
  3. libpnm(3)                  Unix Programmer's Manual                  libpnm(3)
  4.  
  5.  
  6. NAME
  7.      libpnm - functions to support portable anymap programs
  8.  
  9. SYNOPSIS
  10.  
  11.      #include <pnm.h>
  12.      cc ... libpnm.a libppm.a libpgm.a libpbm.a
  13.  
  14.  
  15. DESCRIPTION
  16.  
  17.      TYPES AND CONSTANTS
  18.  
  19.      typedef ... xel;
  20.      typedef ... xelval;
  21.      #define PNM_MAXMAXVAL ...
  22.      extern xelval pnm_pbmmaxval;
  23.  
  24.      Each xel contains three xelvals, each of which should  contain  only  the
  25.      values  between  0  and  PNM_MAXMAXVAL.  pnm_pbmmaxval is the maxval used
  26.                                  -               -
  27.      when a PNM program reads a PBM file.  Normally it is 1; however, for some
  28.      programs, a larger value gives better results.
  29.  
  30.      XEL MANIPULATIONS
  31.  
  32.      xelval PNM_GET1( xel x )
  33.  
  34.      This macro extracts a single value from an xel, when you know it's from a
  35.      PBM  or PGM file.  When it's from a PPM file, use PPM_GETR(), PPM_GETG(),
  36.                                                           -           -
  37.      and PPM_GETB().
  38.             -
  39.  
  40.      void PNM_ASSIGN1( xel x, xelval v )
  41.  
  42.      This macro assigns a single value to an xel, when you know  it's  from  a
  43.      PBM or PGM file.  When it's from a PPM file, use PPM_ASSIGN().
  44.                                                          -
  45.  
  46.      int PNM_EQUAL( xel x, xel y )
  47.  
  48.      This macro checks two xels for equality.
  49.  
  50.      int PNM_FORMAT_TYPE( int format )
  51.             -      -
  52.  
  53.      For distinguishing different file types.
  54.  
  55.      INITIALIZATION
  56.  
  57.      void pnm_init( int* argcP, char* argv[] )
  58.  
  59.      All PNM programs must call this routine.
  60.  
  61.      MEMORY MANAGEMENT
  62.  
  63.      xel** pnm_allocarray( int cols, int rows )
  64.  
  65.      Allocate an array of xels.
  66.  
  67.  
  68.  
  69.                                                                              1
  70.  
  71.  
  72.  
  73. libpnm(3)                  Unix Programmer's Manual                  libpnm(3)
  74.  
  75.  
  76.      xel* pnm_allocrow( int cols )
  77.              -
  78.  
  79.      Allocate a row of the given number of xels.
  80.  
  81.      void pnm_freearray( xel** xels, int rows )
  82.              -
  83.  
  84.      Free the array  allocated  with  pnm_allocarray()  containing  the  given
  85.                                          -
  86.      number of rows.
  87.  
  88.      void pnm_freerow( xel* xelrow )
  89.  
  90.      Free a row of xels.
  91.  
  92.      READING FILES
  93.  
  94.      void pnm_readpnminit( FILE* fp, int* colsP, int* rowsP, xelval*  maxvalP,
  95.      int* formatP )
  96.  
  97.      Read the header from a PNM file, filling in the rows,  cols,  maxval  and
  98.      format variables.
  99.  
  100.      void pnm_readpnmrow( FILE* fp, xel* xelrow, int cols, xelval maxval,  int
  101.              -
  102.      format )
  103.  
  104.      Read a row of xels into the xelrow array.  Format, cols, and maxval  were
  105.      filled in by pnm_readpnminit().
  106.                      -
  107.  
  108.      xel** pnm_readpnm( FILE* fp, int* colsP,  int*  rowsP,  xelval*  maxvalP,
  109.      int* formatP )
  110.  
  111.      Read an entire anymap file into memory, returning the allocated array and
  112.      filling  in  the rows, cols, maxval, and format variables.  This function
  113.      combines  pnm_readpnminit(),   pnm_allocarray()   and   pnm_readpnmrow().
  114.                   -                    -                        -
  115.      Unlike  the  equivalent  functions  in  PBM, PGM, and PPM, it returns the
  116.      format so you can tell what type the file is.
  117.  
  118.      WRITING FILES
  119.  
  120.      void pnm_writepnminit( FILE* fp, int cols, int rows, xelval  maxval,  int
  121.      format, int forceplain )
  122.  
  123.      Write the header for a  portable  anymap  file.   Unlike  the  equivalent
  124.      functions in PBM, PGM, and PPM, you have to specify the output type.  The
  125.      forceplain flag forces a plain-format file to be written, as opposed to a
  126.      raw-format one.
  127.  
  128.      void pnm_writepnmrow( FILE* fp, xel* xelrow, int cols, xelval maxval, int
  129.              -
  130.      format, int forceplain )
  131.  
  132.      Write a row from a portable anymap.
  133.  
  134.      void pnm_writepnm( FILE* fp, xel**  xels,  int  cols,  int  rows,  xelval
  135.              -
  136.      maxval, int format, int forceplain )
  137.  
  138.      Write the header and all data  for  a  portable  anymap.   This  function
  139.      combines pnm_writepnminit() and pnm_writepnmrow().
  140.                  -                      -
  141.  
  142.  
  143.                                                                              2
  144.  
  145.  
  146.  
  147. libpnm(3)                  Unix Programmer's Manual                  libpnm(3)
  148.  
  149.  
  150.      FORMAT PROMOTION
  151.  
  152.      void pnm_promoteformatrow( xel* xelrow,  int  cols,  xelval  maxval,  int
  153.      format, xelval newmaxval, int newformat )
  154.  
  155.      Promote a row of xels from one maxval and format to a new set.  Used when
  156.      combining  multiple anymaps of different types - just take the max of the
  157.      maxvals and the max of the formats, and promote them all to that.
  158.  
  159.      void pnm_promoteformat( xel** xels, int cols, int  rows,  xelval  maxval,
  160.              -
  161.      int format, xelval newmaxval, int newformat )
  162.  
  163.      Promote an entire anymap.
  164.  
  165.      XEL MANIPULATION
  166.  
  167.      xel pnm_whitexel( xelval maxval, int format )
  168.      xel pnm_blackxel( xelval maxval, int format )
  169.  
  170.      Return a white or black xel for the given maxval and format.
  171.  
  172.      void pnm_invertxel( xel* x, xelval maxval, int format )
  173.              -
  174.  
  175.      Invert an xel.
  176.  
  177.      xel pnm_backgroundxelrow( xel*  xelrow,  int  cols,  xelval  maxval,  int
  178.             -
  179.      format )
  180.  
  181.      Figure out an appropriate background xel based on this row.
  182.  
  183.      xel pnm_backgroundxel( xel** xels, int cols, int rows, xelval maxval, int
  184.             -
  185.      format )
  186.  
  187.      Figure out a background xel based on an entire anymap.   This  can  do  a
  188.      slightly better job than pnm_backgroundxelrow().
  189.                                  -
  190.  
  191. SEE ALSO
  192.      pbm(3), pgm(3), ppm(3)
  193.  
  194. AUTHOR
  195.      Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.                                                                              3
  214.  
  215.